﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DCT.CodeBox.SampleApp.PaintCanvas.Frameworks.Utilities
{
    /// <summary>
    /// 控件工具方法
    /// </summary>
    public static class ControlUtility
    {
        /// <summary>
        /// 使用SetStyle方式控件设置双缓冲
        /// </summary>
        /// <param name="setStyleHandler">SetStyle方法</param>
        public static void SetControlDoubleBuffer(Action<ControlStyles,bool> setStyleHandler) 
        {
            setStyleHandler(ControlStyles.AllPaintingInWmPaint, true);
            setStyleHandler(ControlStyles.OptimizedDoubleBuffer, true);
            setStyleHandler(ControlStyles.UserPaint, true);
        }
    }
}
